package com.adou.d16.bio;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.Writer;

public class BRWest3 {
    public static void main(String[] args) {
        try (
                // 1.定义字符输出流和文件接通
                Writer fw = new FileWriter("d1-helloword-app\\src\\it05_out.txt");
//                Writer fw = new FileWriter("D:\\code\\javasepro\\d1-helloword-app\\src\\it05_out.txt");
//                Writer fw = new FileWriter("d1-helloword-app\\src\\it05_out.txt", true);
                final BufferedWriter bw = new BufferedWriter(fw);
        ) {

            // 2.写1个字符
            bw.write('a');
            bw.write(98);
            bw.write('磊');

            bw.newLine();
            // 3.字符串
            bw.write("我爱你中国abc", 0, 5);
            bw.newLine();


            // 4.写一个字符数组
            char[] buffer = {'中','国','a','b','c'};
            bw.write(buffer);
            bw.newLine();


            // 5.写部分数组
            bw.write(buffer, 0, 2);
            bw.newLine();





        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("写出完成");
    }
}
